//
//  EdictDictionary.m
//  Edict
//
//  Created by Mathieu on 15/09/06.
//  Copyright 2006 __MyCompanyName__. All rights reserved.
//

#import "EdictDictionary.h"


@implementation EdictDictionary

#pragma mark Archiving Support
- (void)encodeWithCoder:(NSCoder *)coder
{
    //[super encodeWithCoder:coder];
	//load the entire file from the url, and load the data in NOT in the actual entity, but perhaps just in it's own object
	[coder encodeObject:[self valueForKey:@"capability"] forKey:@"LCapability"];
	[coder encodeObject:[self valueForKey:@"languageIconData"] forKey:@"LLanguageIconData"];
	[coder encodeObject:[self valueForKey:@"name"] forKey:@"LName"];
	[coder encodeObject:[self valueForKey:@"nativeName"] forKey:@"LNativeName"];
    return;
}


- (id)initWithCoder:(NSCoder *)coder
{
	//unpack all that data from the archive, put it in 
	LanguageMO *lang = [NSEntityDescription insertNewObjectForEntityForName:@"Language" inManagedObjectContext:[[NSApp delegate] managedObjectContext]];
	[lang setValue:[coder decodeObjectForKey:@"LCapability"] forKey:@"capability"];
	[lang setValue:[coder decodeObjectForKey:@"LLanguageIconData"] forKey:@"languageIconData"];
	[lang setValue:[coder decodeObjectForKey:@"LName"] forKey:@"name"];  
	[lang setValue:[coder decodeObjectForKey:@"LNativeName"] forKey:@"nativeName"]; 
	return self;
}

-(NSString *)dictType{
	return @"EdictDictionary";
}

@end
